package com.pxxy.yuyi.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pxxy.yuyi.dao.LeaveDao;
import com.pxxy.yuyi.entity.Leave;
import com.pxxy.yuyi.service.LeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by IntelliJ IDEA
 *
 * @Author : XuWen
 * @create 2021/6/21 0:44
 */
@Service
public class LeaveServiceImpl implements LeaveService {
    @Autowired
    private LeaveDao leaveDao;

    @Override
    public Integer insertLeave(Leave leave) {
        return leaveDao.insertLeave(leave);
    }

    @Override
    public PageInfo<Leave> selectLeave(Integer pageNum) {
        PageHelper.startPage(pageNum,3);
        List<Leave> list= leaveDao.selectLeave();
        return new PageInfo<Leave>(list);
    }
    @Override
    public Integer deleteLeave(Integer lid) {

        return leaveDao.deleteLeave(lid);
    }

    @Override
    public Integer update(Leave leave) {
        return leaveDao.updateLeave(leave);
    }

    @Override
    public PageInfo<Leave> selectLeaves(Integer pageNum) {
        PageHelper.startPage(pageNum,6);
        List<Leave> list= leaveDao.selectLeaves();
        return new PageInfo<Leave>(list);
    }
}
